package kernel.loaders.ascii;

/**
 *
 * @author George
 */
 public class Token {

    public int kind;         //tipo do token
    public String spelling;  //valor do token
    
    private final static String [] spellings = {
        "<identifier>", "<float>"};
    
    public static final int IDENTIFIER = 0, FLOAT = 1;
                
    public Token(int kind, String spelling) {
        this.kind = kind;
        this.spelling = spelling;
           for (byte k = IDENTIFIER; k <= FLOAT; k++)
             if (spelling.equals(spellings[k])) {
                this.kind = k;
                break;
        }
    }    
    
    public String getKindString () {
        return this.getKindString(kind);
    }
    
    public String getKindString (int n) {
        
        switch (n) {
            case 0 : return "IDENTIFIER";
            case 1 : return "FLOAT";           
            
            default: return "ERROR!";
        }        
    }
   

    
}
